#ifndef __PVMDEFS_H__
#define __PVMDEFS_H__

#ifdef PVM_HAVE_CONFIG_H
#include "pvm_config.h"
#endif

#define PVM_INVALID_FILE_SIZE -1

#if defined(__ANDROID__)
	#define PVM_USE_POSIX
#endif


#if (defined(PVM_STATICLIB))
	#define PVMAPI

	#if	defined(PVM_USE_POSIX) && defined(WIN32) //just for tests on Windows platform
		#define PVMCALL __cdecl
	#else
		#define PVMCALL
	#endif

#else
	#if ((defined(_WIN32_WCE) || defined(WIN32)) && !defined(__SYMBIAN32__))
		#if	defined(PVM_USE_POSIX)
			#define PVMCALL __cdecl
		#else
			#define PVMCALL __stdcall
		#endif

		#ifdef PVM_EXPORTS
			#define PVMAPI __declspec(dllexport)
		#else
			#define PVMAPI __declspec(dllimport)
		#endif
	#endif//_WIN32_WCE || WIN32


	#if defined(__SYMBIAN32__)
		#define PVMCALL
		#ifdef PVM_EXPORTS
			#define PVMAPI     EXPORT_C
		#else
			#define PVMAPI     IMPORT_C
		#endif
	#endif//__SYMBIAN32__
#endif

//string defines

#if ((defined(_WIN32_WCE) || defined(WIN32)) && !defined(__SYMBIAN32__)) && !defined(SHP)
	#define PVM_FORCEINLINE __forceinline
	#ifdef _UNICODE
		#define PVM_STR_WIDEN2(x) L ## x
		#define _PVM_STR_MACRO(x) PVM_STR_WIDEN2(x)
		#define _PVM_STR(a) ((const pvm_char*)L ## a)
		#define PVM_STRINGIZE(p) PVM_STRINGIZE2(p)
		#define PVM_STRINGIZE2(p) L#p
	#else
		#define _PVM_STR_MACRO(x) x
		#define _PVM_STR(a) a
		#define PVM_STRINGIZE(p) PVM_STRINGIZE2(p)
		#define PVM_STRINGIZE2(p) #p
	#endif//_UNICODE
#else
	#define PVM_FORCEINLINE inline


	#if defined(__SYMBIAN32__) || defined(SHP) || defined(TIZEN)
			#define PVM_STR_WIDEN2(x) L ## x
			#define _PVM_STR_MACRO(x) PVM_STR_WIDEN2(x)
			#define _PVM_STR(a) ((const pvm_char*)L ## a)
			#define PVM_STRINGIZE(p) PVM_STRINGIZE2(p)
			#define PVM_STRINGIZE2(p) L#p
	#elif defined(IPHONE) || defined(__ANDROID__) || defined(__linux)
			#define _PVM_STR_MACRO(x) x
			#define _PVM_STR(a) a
			#define PVM_STRINGIZE(p) PVM_STRINGIZE2(p)
			#define PVM_STRINGIZE2(p) #p
	#elif !defined(IW_PLATFORM_S3E)
	#error "Error - unknown platform!"
	#endif

#endif



#if defined(IW_PLATFORM_S3E)
#	if defined(_UNICODE) || defined(UNICODE)
		#define PVM_STR_WIDEN2(x) L ## x
		#define _PVM_STR_MACRO(x) PVM_STR_WIDEN2(x)
		#define _PVM_STR(a) ((const pvm_char*)L ## a)
		#define PVM_STRINGIZE(p) PVM_STRINGIZE2(p)
		#define PVM_STRINGIZE2(p) L#p
#	else
		#define _PVM_STR_MACRO(x) x
		#define _PVM_STR(a) a
		#define PVM_STRINGIZE(p) PVM_STRINGIZE2(p)
		#define PVM_STRINGIZE2(p) #p
#	endif
#endif

#define PVM_STRINGIZE_CHAR(p) PVM_STRINGIZE2_CHAR(p)
#define PVM_STRINGIZE2_CHAR(p) #p


#define _PVM_FILE_ _PVM_STR_MACRO(__FILE__)
#define _PVM_LINE_STRING_ PVM_STRINGIZE(__LINE__)

#define _PVM_FILE_WITH_LINE_ ((const pvm_char*)(_PVM_STR_MACRO(__FILE__)_PVM_STR_MACRO("(")_PVM_STR_MACRO(PVM_STRINGIZE_CHAR(__LINE__))_PVM_STR_MACRO(")")))

#endif//__PVMDEFS_H__


